package com.es.pay.ctmGrade;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class CreateCtmGradeDoAction extends ActionSupport implements ServletRequestAware{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HttpServletRequest request;
	 
	   public String execute()throws Exception
	   {
		   String ctm_grade_id = request.getParameter("ctm_grade_id");
		   String grade = request.getParameter("grade");
		   String[] gradeAry  = null;
		   String message ="";
		   if(grade!=null)
			   gradeAry = grade.split(",");
		   if(gradeAry.length!=8||ctm_grade_id==null||"".equals(ctm_grade_id)){
			   request.setAttribute("message", "CTM评分因系统原因，评分失败，请重新评分");
			   return "success";
		   }
		   CtmGradeBiz ctmBiz = new CtmGradeBiz();
		   ArrayList<String> param = new ArrayList<String>();
		   param.add(gradeAry[0]);
		   param.add(gradeAry[1]);
		   param.add(gradeAry[2]);
		   param.add(gradeAry[3]);
		   param.add(gradeAry[4]);
		   param.add(gradeAry[5]);
		   param.add(gradeAry[6]);
		   param.add(gradeAry[7]);
		   param.add(ctm_grade_id);
		   if(ctmBiz.updateCtmGrade(param))
			   message = "CTM评分操作成功";
		   else
			   message = "CTM评分因系统原因，评分失败，请重新评分";
		   request.setAttribute("message",message);
		   return "success";
	   }
	
	   public void setServletRequest(HttpServletRequest request) {
		     this.request = request;
		   }
}

